import React from 'react';
import { Routes, Route } from 'react-router-dom';
import { AuthProvider } from './contexts/AuthContext';
import Layout from './components/Layout';
import Home from './pages/Home';
import Login from './pages/Login';
import Register from './pages/Register';
import Profile from './pages/Profile';
import Upload from './pages/Upload';
import VideoDetail from './pages/VideoDetail';
import LiveStreams from './pages/LiveStreams';
import CreateLiveStream from './pages/CreateLiveStream';
import LiveStreamView from './pages/LiveStreamView';
import LiveStreamBroadcast from './pages/LiveStreamBroadcast';
import Following from './pages/Following';
import Messages from './pages/Messages';
import ProtectedRoute from './components/ProtectedRoute';

function App() {
  return (
    <AuthProvider>
      <Routes>
        <Route path="/" element={<Layout />}>
          <Route index element={<Home />} />
          <Route path="login" element={<Login />} />
          <Route path="register" element={<Register />} />
          <Route path="profile" element={<ProtectedRoute><Profile /></ProtectedRoute>} />
          <Route path="upload" element={<ProtectedRoute><Upload /></ProtectedRoute>} />
          <Route path="video/:id" element={<VideoDetail />} />
          <Route path="following" element={<Following />} />
          <Route path="messages" element={<Messages />} />
          <Route path="live" element={<LiveStreams />} />
          <Route path="live/create" element={<ProtectedRoute><CreateLiveStream /></ProtectedRoute>} />
          <Route path="live/:id" element={<LiveStreamView />} />
          <Route path="live/:id/broadcast" element={<ProtectedRoute><LiveStreamBroadcast /></ProtectedRoute>} />
        </Route>
      </Routes>
    </AuthProvider>
  );
}

export default App; 